<form id="dialog-add-content" class="dialog-add-content" name="invoiceEditForm" novalidate>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">发票类别</span>
                <span class="col-md-9">
                    <input name="invoice_category" select2 ng-model="invoiceInfo.invoice_category"
                           select2-model="ddl2InvoiceCategory"
                           config="ddlConfigInvoiceCategory" type="text" placeholder="发票类别" class="form-control"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_category.$touched) && invoiceEditForm.invoice_category.$error.required"
                          class="error ng-hide c-red lh30">发票类别不能为空</span>
                </span>
        <span class="col-md-3 lh30">发票代码</span>
                <span class="col-md-9">
                    <input name="invoice_code" type="text" ng-model="invoiceInfo.invoice_code"
                           class="form-control" id="inputPrice" placeholder="发票代码"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_code.$touched) && invoiceEditForm.invoice_code.$error.required"
                          class="error ng-hide c-red lh30">发票代码不能为空</span>
                 </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">发票类型</span>
                <span class="col-md-9">
                    <input name="invoice_type" select2 ng-model="invoiceInfo.invoice_type"
                           select2-model="ddl2InvoiceType"
                           config="ddlConfigInvoiceType" type="text" placeholder="发票类型" class="form-control"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="invoiceEditForm.invoice_type.$touched && invoiceEditForm.invoice_type.$error.required"
                          class="error ng-hide c-red lh30">发票类型不能为空</span>
                </span>
        <span class="col-md-3 lh30">发票号码</span>
                <span class="col-md-9">
                    <input name="invoice_no" type="text" class="form-control" ng-model="invoiceInfo.invoice_no"
                           placeholder="发票号码" ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_no.$touched) && invoiceEditForm.invoice_no.$error.required"
                          class="error ng-hide c-red lh30">发票号码不能为空</span>
                </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">申请人</span>
                <span class="col-md-9">
                    <div ng-if="invoiceInfo.editMode != 1">
                        <input id="idProposer" name="proposer_id" select2 ng-model="invoiceInfo.proposer_id"
                               select2-model="ddl2InvoiceProposer"
                               ng-disabled="false"
                               config="ddlConfigInvoiceProposer" type="text" placeholder="申请人"
                               class="form-control select-check-hide" required>
                    </div>

                    <div ng-if="invoiceInfo.editMode == 1">
                        <input id="idProposer" name="proposer_id" select2 ng-model="invoiceInfo.proposer_id"
                               select2-model="ddl2InvoiceProposer"
                               ng-disabled="true"
                               config="ddlConfigInvoiceProposer" type="text" placeholder="申请人"
                               class="form-control select-check-hide" required>
                    </div>

                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.proposer_id.$touched) && invoiceEditForm.proposer_id.$error.required"
                          class="error ng-hide c-red lh30">申请人不能为空</span>
                </span>
        <span class="col-md-3 lh30">客户名称</span>
                <span class="col-md-9">
                    <input type="text" name="customer_name" class="form-control"
                           ng-model="invoiceInfo.customer_name" placeholder="客户名称"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.customer_name.$touched) && invoiceEditForm.customer_name.$error.required"
                          class="error ng-hide c-red lh30">客户名称不能为空</span>
                </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">开票单位</span>
                <span class="col-md-9">
                    <div ng-if="invoiceInfo.editMode != 1">
                        <input id="idInvoiceCompany" name="invoice_company_id" select2
                               ng-model="invoiceInfo.invoice_company_id"
                               select2-model="ddl2InvoiceCompany"
                               ng-disabled="false"
                               config="ddlConfigInvoiceCompany" type="text" placeholder="开票单位"
                               class="form-control select-check-hide" required>
                    </div>

                     <div ng-if="invoiceInfo.editMode == 1">
                         <input id="idInvoiceCompany" name="invoice_company_id" select2
                                ng-model="invoiceInfo.invoice_company_id"
                                select2-model="ddl2InvoiceCompany"
                                ng-disabled="true"
                                config="ddlConfigInvoiceCompany" type="text" placeholder="开票单位"
                                class="form-control select-check-hide" required>
                     </div>

                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_company_id.$touched) && invoiceEditForm.invoice_company_id.$error.required"
                          class="error ng-hide c-red lh30">开票单位不能为空</span>
                </span>
        <span class="col-md-3 lh30">开票金额</span>
                <span class="col-md-9">
                    <input type="number" name="invoice_amount" class="form-control invoice-amount"
                           ng-model="invoiceInfo.invoice_amount" placeholder="开票金额"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_amount.$touched) && invoiceEditForm.invoice_amount.$error.required"
                          class="error ng-hide c-red lh30">开票金额不能为空</span>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_amount.$touched) && invoiceEditForm.invoice_amount.$error.number"
                          class="error ng-hide c-red lh30">开票金额必须为数值类型</span>
                </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">开票日期</span>
                <span class="col-md-9">
                    <input type="text" name="invoice_date" class="form-control input-date"
                           ng-model="invoiceInfo.invoice_date" ui-date format="yyyy-MM-dd"
                           style="width: 100%" placeholder="开票日期"
                           ng-disabled="invoiceInfo.editMode == 1" required>
                    <span role="alert"
                          ng-show="(invoiceEditForm.$submitted || invoiceEditForm.invoice_date.$touched) && invoiceEditForm.invoice_date.$error.required"
                          class="error ng-hide c-red lh30">开票日期不能为空</span>
                </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">发票摘要</span>

        <div class="col-md-21">
            <button class="btn btn-yellow" ng-click="newInvoiceAbstract()" ng-if="invoiceInfo.editMode != 1">新建发票摘要
            </button>
            <div class="table-wrap mh60 mt10">
                <table class="table">
                    <thead>
                    <tr>
                        <th style="width: 100px;">序号</th>
                        <th style="width: 250px;">摘要类型</th>
                        <th style="width: 250px;">金额</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="record in invoiceInfo.invoiceSummarys" style="vertical-align: top">
                        <td><p ng-bind="$index + 1"></p></td>
                        <td>
                            <input name="summary_type_{{$index}}" select2 ng-model="record.summary_type"
                                   select2-model="ddl2InvoiceSummary"
                                   config="ddlConfigInvoiceSummaryType" type="text" placeholder="摘要类型"
                                   class="form-control" ng-disabled="invoiceInfo.editMode == 1" required>
                            <span role="alert"
                                  ng-show="(invoiceEditForm.$submitted || invoiceEditForm['summary_type_' + $index].$touched) && invoiceEditForm['summary_type_' + $index].$error.required"
                                  class="error ng-hide c-red lh30">摘要类型不能为空</span>
                        </td>
                        <td>
                            <input type="number" name="summary_amount_{{$index}}"
                                   class="form-control summary-amount"
                                   ng-model="record.summary_amount"
                                   placeholder="摘要金额" ng-disabled="invoiceInfo.editMode == 1" required>
                            <span role="alert"
                                  ng-show="(invoiceEditForm.$submitted || invoiceEditForm['summary_amount_' + $index].$touched) && invoiceEditForm['summary_amount_' + $index].$error.required"
                                  class="error ng-hide c-red lh30">摘要金额不能为空</span>
                            <span role="alert"
                                  ng-show="(invoiceEditForm.$submitted || invoiceEditForm['summary_amount_' + $index].$touched) && invoiceEditForm['summary_amount_' + $index].$error.number"
                                  class="error ng-hide c-red lh30">开票金额必须为数值类型</span>
                        </td>
                        <td>
                            <p ng-if="invoiceInfo.invoiceSummarys.length>1">
                                <a href="javascript:;" ng-click="removeInvoiceAbstract($index)"
                                   ng-if="invoiceInfo.editMode != 1">删除</a>
                            </p>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">备注</span>
                <span class="col-md-21">
                    <textarea class="form-control" ng-model="invoiceInfo.remark" placeholder="备注"
                              ng-disabled="invoiceInfo.editMode == 1"></textarea>
                </span>
    </div>
    <div class="mtb20 clearfix">
        <span class="col-md-3 lh30">附件</span>

        <div class="col-md-21">
            <div class="clearfix">
                <div id="fileupload" class="fileinput-button btn fl" ng-disabled="invoiceInfo.editMode == 1">
                    <span class="f13">上传附件</span>
                    <input type="file" name="file" accept=".xls,.xlsx,.doc,.docx,.pdf,.msg"
                           ng-disabled="invoiceInfo.editMode == 1">
                </div>
                <span class="fl lh30 f12">(仅支持xls(x),doc(x),pdf,msg文件，且文件大小不得超过10M)</span>
            </div>
            <div class="c-red f13 clearfix" style="clear:both;display: none;" id="fileupload_tip">上传中……</div>
            <div class="c-red f13 clearfix" style="clear:both;display: none" id="fileupload_error">上传失败</div>
            <input type="hidden" id="fileupload_url" value="{{invoiceInfo.invoiceDocuments}}"/>

            <div>
                <div style="height: 28px;display: inline-block;margin-right: 20px"
                     ng-repeat="file in invoiceInfo.invoiceDocuments" ng-if="file.__type != 'delete'">
                    <a target="_blank" href="{{file.document_path}}">{{ file.document_name}}</a>
                    <a class="glyphicon glyphicon-trash" title="删除附件" href="javascript: void(0)"
                       ng-click="delAttachment(file,$index)" ng-if="invoiceInfo.editMode != 1"></a>
                </div>
            </div>
        </div>
    </div>
</form>